﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Genetic
{
    class Program
    {
        static void Main(string[] args)
        {
        }
        
    }

    public class Mastermind {
        private String goalString;
        private Char[] characterSet;
        private Random r;

        public Mastermind(String goal, Char[] charSet) {
            goalString = goal;
            characterSet = charSet;
            r = new Random(Environment.TickCount);
        }
        public String crossover(String a, String b) {
            int splitIndex = r.Next() % a.Count();
            String c = a.Substring(0, splitIndex) + b.Substring(splitIndex, (b.Count() - splitIndex));
            return c;
        }
        public int fitnessTest(String goal, String a) {
            int score = 0;
            for (int i = 0; i < goal.Count(); i++) {
                if (goal[i] == a[i])
                {
                    score += 2;
                }
                else if (goal.Contains(a[i]))
                {
                    score += 1;
                }
                else score += 0;
            }
            return score;
        }

    }
}
